package com.coocaa.ops.plus.dashboard.v1.aiposter;

import com.coocaa.ops.plus.core.third.visionhub.VisionFeignClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;

/**
 * @author bijiahao
 * @description
 * @date 2020/4/22 10:43
 */
@RestController
@RequestMapping("/v1/aiPoster")
public class AiPosterController {

    @Autowired
    private VisionFeignClientService visionHubFeignService;


    @RequestMapping("/textDetect")
    public Object textDetect(HttpServletRequest request,@RequestParam("file") MultipartFile file,
                             @RequestParam("type") String type,
                             @RequestParam("withPosition") Integer withPosition
                             ) throws Exception {
        return visionHubFeignService.textDetect(file, type, withPosition);
    }

    @RequestMapping("/drawContour")
    public Object drawContour(HttpServletRequest request,@RequestParam(value = "file", required = false) MultipartFile file,
                             @RequestParam(value = "posterUrl", required = false) String posterUrl
                             ) throws Exception {
        return visionHubFeignService.drawContour(file, posterUrl);
    }
}
